<?php

namespace common\models;

use Yii;
use yii\db\ActiveRecord;

class Admin extends ActiveRecord
{
    public static function tableName()
    {
        return 'admin';
    }

    public static function getDb()
    {
        return Yii::$app->get('db');
    }

    /**
     * 验证规则
     * @return array
     */
    public function rules()
    {
        return [
            [['id'], 'integer'],
            [['id'], 'required'],
            [['username','email','password','last_ip'], 'string'],
            [['last_time','created_time','updated_time'], 'safe'],
        ];
    }

    /**
     * 标签名
     * @return array
     */
    public function attributeLabels()
    {
        return [
            'id' => 'Id',
            'username' => 'Username',
            'email' => 'Email',
            'password' => 'Password',
            'last_ip' => 'Last Ip',
            'last_time' => 'Last Time',
            'created_time' => 'Created Time',
            'updated_time' => 'Updated Time'
        ];
    }
}